<script lang="ts" setup>
defineOptions({
  name: "MediaIntro",
});
import { getImg } from "@/utils";

let props = defineProps({
  item: {
    type: [Object],
    default: () => ({}),
  },
});
let emit = defineEmits(["update:item"]);
let item = useRefModel(props, "item", emit);

import dayjs from "@/utils/dayjs";

let currentTimeZone = dayjs.tz.guess();
let timeStamp = item.value.date * 1000;
if (isEmptyType(timeStamp)) {
  timeStamp = Date.now();
}
let date = dayjs(timeStamp).tz(currentTimeZone).format("DD-MM-YYYY");
</script>
<template>
  <div class="intro">
    <div class="start">
      <div v-if="false" class="avatar-img">
        <img class="circular-img" :src="item.avatarImg" alt="" />
      </div>
      <div class="media">
        <div class="title">{{ item.name }}</div>
        <div v-if="false" class="position">
          <img class="mini-img" :src="getImg('Group 13@2x.png')" alt="" />
        </div>
      </div>
    </div>
    <div class="end">
      <div class="date" style="white-space: nowrap">{{ date }}</div>
      <div class="divider">|</div>
      <div class="time" style="white-space: nowrap">{{ item.time }}</div>
    </div>
  </div>
</template>
<style lang="scss" scoped>
.intro {
  position: absolute;
  bottom: 0px;
  left: 0px;
  width: 100%;
  backdrop-filter: blur(3.5px);
  background-color: rgba(105, 103, 103, 0.2);
  border-radius: 0 0 10px 10px;
  height: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
  padding: 0 10px;
  .start {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    column-gap: 10px;
    .avatar-img {
      .circular-img {
        width: 30px;
        aspect-ratio: 1/1;
        border-radius: 50%;
      }
    }
    .media {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      align-items: stretch;

      .title {
        font-weight: 400;
        font-size: 12px;
      }
      .position {
        font-weight: 400;
        font-size: 10px;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        .mini-img {
          width: 50px;
        }
      }
    }
  }
  .end {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    column-gap: 4px;
    font-weight: 400;
    font-size: 12px;
  }
}
</style>
